feat(event): support multi-event view with newline-separated IDs (CLI-1HT)#903
Merged
feat(event): support multi-event view with newline-separated IDs (CLI-1HT)#903
Conversation
Contributor
|
Contributor
Codecov Results 📊✅ 6569 passed | Total: 6569 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 79.88%. Project has 13346 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 76.02% 76.06% +0.04%
==========================================
Files 296 296 —
Lines 55640 55745 +105
Branches 0 0 —
==========================================
+ Hits 42298 42399 +101
- Misses 13342 13346 +4
- Partials 0 0 —Generated by Codecov Action |
55b4790 to
c1455b8
Compare
c1455b8 to
249a176
Compare
…-1HT) Agents (Codex) sometimes paste multiple event IDs as a single newline-separated argument, e.g. `org/project/id1\nid2\nid3`. Instead of rejecting the input with a ValidationError, expand newline-separated args and fetch all events in parallel. Changes: - Add `expandNewlineArgs` to split newline-separated positional args - Change `parsePositionalArgs` to collect extra event IDs beyond the first two args into `extraEventIds` - Add `collectEventIds` and `fetchMultipleEvents` helpers for parallel multi-event fetching with per-ID failure handling - Change output type to `{ events: SingleEventViewData[] }` — single event yields flat JSON (backward compat), multiple events yield array - Update human formatter to separate multiple events with `---` Fixes CLI-1HT
249a176 to
e9b90ee
Compare
…xtraEventIds - Export and test splitOnNewlines, expandNewlineArgs, collectEventIds, formatEventView, jsonTransformEventView, fetchMultipleEvents - Test formatEventView with span tree lines and multi-event separator - Test jsonTransformEventView single vs multi-event and field filtering - Test fetchMultipleEvents success, prefetch, partial failure, all-fail - Test parsePositionalArgs extraEventIds in swap-detected path - Patch coverage at 91%+ (remaining uncovered: func() integration paths)
…extract shared splitNewlineArg Fix bug where expanded 'org/project/id1\nid2' was incorrectly parsed with first arg as target (losing id1). When the first arg has 2+ slashes, route through parseSingleArg to correctly split org/project from id. Extract splitNewlineArg to src/lib/arg-parsing.ts as a shared utility, replacing the duplicate splitLogIds in log/view.ts and splitOnNewlines in event/view.ts.
…l failure When multiple events are requested but some fail, the JSON output shape should be deterministic based on what was requested, not what succeeded. Use requestedCount (from allEventIds.length) instead of events.length to decide flat object vs array format. Also extract splitNewlineArg to src/lib/arg-parsing.ts as shared utility, replacing duplicates in event/view.ts and log/view.ts.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 08099f6. Configure here.
Agent-pasted lists often contain duplicate IDs. Deduplicate using a Set to avoid redundant API fetches and duplicate output entries.
…g, relocate tests Address self-review findings: - Warn when --web flag is used with extra event IDs (only first opens) - Replace splitLogIds alias with direct splitNewlineArg calls in log/view.ts - Move splitNewlineArg tests to test/lib/arg-parsing.test.ts (correct location) - Remove orphaned JSDoc block from log/view.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
pLimit(5))splitNewlineArgutility from duplicated code inlog viewMotivation
CLI-1HT: A Codex agent passed 45 event IDs as a single newline-separated argument to
sentry event view:After splitting on the last
/, the extractedidcontained embedded newlines which triggeredrejectControlChars→ValidationError.Instead of stripping extra IDs, this treats the input as a multi-event request — matching how
log viewalready handles newline-separated IDs.Changes
src/commands/event/view.tsexpandNewlineArgs— splits each positional arg on newlines (via sharedsplitNewlineArg)collectEventIds— validates extra hex IDs, deduplicates, skips invalid onesfetchMultipleEvents— parallel fetch withpLimit(5)concurrency cap, per-ID failure handlingparsePositionalArgs— detects expandedorg/project/idargs (2+ slashes) and routes through single-arg path; collectsextraEventIdsfrom remaining args (including swapped-args path)EventViewData— wrapsevents: SingleEventViewData[]+requestedCountfor deterministic JSON shape even on partial failuresjsonTransformEventView— usesrequestedCount(notevents.length) to decide flat object vs array, preventing non-deterministic shape changes on partial fetch failuresformatEventView— renders multiple events separated by-----webflag — warns when extra event IDs are ignored (only first opens)src/lib/arg-parsing.tssplitNewlineArg— shared utility for splitting newline-separated args (replaces duplicatedsplitLogIdsinlog/view.ts)src/commands/log/view.tssplitLogIdswith directsplitNewlineArgcallsTests
splitNewlineArg,expandNewlineArgs,collectEventIds(including dedup),formatEventView(multi-event, span trees),jsonTransformEventView(single/multi/partial-failure/field-filtering),fetchMultipleEvents(success/prefetch/partial-failure/all-fail),parsePositionalArgsextra IDs (normal/swapped/2+-slash paths)Fixes CLI-1HT